﻿using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
namespace Robotec.NET.Application;

    /// <summary>
    /// 数据迁移输出参数
    /// </summary>
    public class SysDataTransferDto
    {
        /// <summary>
        /// 源数据链接字符串
        /// </summary>
        public string? SourceConnectionString { get; set; }
        
        /// <summary>
        /// 源数据库配置编号
        /// </summary>
        public string? SourceConfigId { get; set; }
        
        /// <summary>
        /// 源数据库名称
        /// </summary>
        public string? SourceDbName { get; set; }
        
        /// <summary>
        /// 源数据库类型
        /// </summary>
        public MyDbType? SourceDbType { get; set; }
        
    [SugarColumn(IsJson =true)]
    public List<object> SourceTableAttribute { get; set; }   = new List<object>();
    [SugarColumn(IsJson =true)]
    public List<object> SourceOnlyTransferTables { get; set; }   = new List<object>();
    [SugarColumn(IsJson =true)]
    public List<object> SourceExcludeTables { get; set; }   = new List<object>();
        /// <summary>
        /// 是否清空目标表
        /// </summary>
        public bool? ClearTargetTableFlag { get; set; }
        
        /// <summary>
        /// 目标数据库配置编码
        /// </summary>
        public string? TargetConfigId { get; set; }
        
        /// <summary>
        /// 目标数据库名称
        /// </summary>
        public string? TargetDbName { get; set; }
        
        /// <summary>
        /// 目标数据库类型
        /// </summary>
        public MyDbType? TargetDbType { get; set; }
        
        /// <summary>
        /// 目标数据链接字符串
        /// </summary>
        public string? TargetConnectionString { get; set; }
        
        /// <summary>
        /// 迁移日志内容
        /// </summary>
        public string? Description { get; set; }
        
        /// <summary>
        /// Id
        /// </summary>
        public long Id { get; set; }
        
        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }
        
    }

    
  /// <summary>
    /// 数据迁移导出导入
    /// </summary>
    [ExcelExporter(Name = "数据迁移", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true,AutoCenter =true)]
    [ExcelImporter( IsLabelingError = true,SheetName ="数据迁移")]
    public class ExportImportSysDataTransferDto
    {
        /// <summary>
        /// 源数据链接字符串
        /// </summary>
        [ExporterHeader(DisplayName = "源数据链接字符串", IsBold = true)]
        [ImporterHeader(Name = "源数据链接字符串")]
        public string? SourceConnectionString { get; set; }
        
        /// <summary>
        /// 源数据库配置编号
        /// </summary>
        [ExporterHeader(DisplayName = "源数据库配置编号", IsBold = true)]
        [ImporterHeader(Name = "源数据库配置编号")]
        public string? SourceConfigId { get; set; }
        
        /// <summary>
        /// 源数据库名称
        /// </summary>
        [ExporterHeader(DisplayName = "源数据库名称", IsBold = true)]
        [ImporterHeader(Name = "源数据库名称")]
        public string? SourceDbName { get; set; }
        
        /// <summary>
        /// 源数据库类型
        /// </summary>
         [ExporterHeader(DisplayName = "源数据库类型", IsBold = true)]
        [ImporterHeader(Name = "源数据库类型")]
        public MyDbType? SourceDbType { get; set; }
        
       /// <summary>
        /// 需要迁移源表的特性
        /// </summary>
         [ExporterHeader(DisplayName = "需要迁移源表的特性", IsBold = true)]
        [ImporterHeader(Name = "需要迁移源表的特性")]
        [SugarColumn(IsJson =true)]
    public List<object> SourceTableAttribute { get; set; }   = new List<object>();
       /// <summary>
        /// 只更新的表
        /// </summary>
         [ExporterHeader(DisplayName = "只更新的表", IsBold = true)]
        [ImporterHeader(Name = "只更新的表")]
        [SugarColumn(IsJson =true)]
    public List<object> SourceOnlyTransferTables { get; set; }   = new List<object>();
       /// <summary>
        /// 需要排除的表
        /// </summary>
         [ExporterHeader(DisplayName = "需要排除的表", IsBold = true)]
        [ImporterHeader(Name = "需要排除的表")]
        [SugarColumn(IsJson =true)]
    public List<object> SourceExcludeTables { get; set; }   = new List<object>();
        /// <summary>
        /// 是否清空目标表
        /// </summary>
        [ExporterHeader(DisplayName = "是否清空目标表", IsBold = true)]
        [ImporterHeader(Name = "是否清空目标表")]
        public bool? ClearTargetTableFlag { get; set; }
        
        /// <summary>
        /// 目标数据库配置编码
        /// </summary>
        [ExporterHeader(DisplayName = "目标数据库配置编码", IsBold = true)]
        [ImporterHeader(Name = "目标数据库配置编码")]
        public string? TargetConfigId { get; set; }
        
        /// <summary>
        /// 目标数据库名称
        /// </summary>
        [ExporterHeader(DisplayName = "目标数据库名称", IsBold = true)]
        [ImporterHeader(Name = "目标数据库名称")]
        public string? TargetDbName { get; set; }
        
        /// <summary>
        /// 目标数据库类型
        /// </summary>
         [ExporterHeader(DisplayName = "目标数据库类型", IsBold = true)]
        [ImporterHeader(Name = "目标数据库类型")]
        public MyDbType? TargetDbType { get; set; }
        
        /// <summary>
        /// 目标数据链接字符串
        /// </summary>
        [ExporterHeader(DisplayName = "目标数据链接字符串", IsBold = true)]
        [ImporterHeader(Name = "目标数据链接字符串")]
        public string? TargetConnectionString { get; set; }
        
        /// <summary>
        /// 迁移日志内容
        /// </summary>
        [ExporterHeader(DisplayName = "迁移日志内容", IsBold = true)]
        [ImporterHeader(Name = "迁移日志内容")]
        public string? Description { get; set; }
        
        /// <summary>
        /// 更新时间
        /// </summary>
        [ExporterHeader(DisplayName = "更新时间", IsBold = true)]
        [ImporterHeader(Name = "更新时间")]
        public DateTime? UpdateTime { get; set; }
        
    }